]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionSystem: Add method for opening extension prefs
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 1 Apr 2020 19:04:03 +0000 (21:04 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 3 Apr 2020 13:23:26 +0000 (15:23 +0200)
Extension that want to expose their own preferences (for example as menu
items) do that by passing their UUID to gnome-shell-extension-prefs.

But since 3.36.1 the app is optional and no longer accepts arguments on
the command line. To adjust, extensions now need to make a D-Bus call
the extensions portal, just like the app and gnome-shell.

We will add a convenience method for that purpose, so it makes
sense to share the existing code. As it's extension-related, the
extension manager looks like the right place ...

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1163

js/ui/extensionSystem.js
js/ui/shellDBus.js

index 4fab0c334efa3a0373f510a1d8a7204281e32154..4cce0c52dea94dd9f201103134251f0ace8024f3 100644 (file)
@@ -215,6 +215,24 @@ var ExtensionManager = class {
         return true;
     }
 
+    openExtensionPrefs(uuid, parentWindow, options) {
+        const extension = this.lookup(uuid);
+        if (!extension || !extension.hasPrefs)
+            return false;
+
+        Gio.DBus.session.call(
+            'org.gnome.Shell.Extensions',
+            '/org/gnome/Shell/Extensions',
+            'org.gnome.Shell.Extensions',
+            'OpenExtensionPrefs',
+            new GLib.Variant('(ssa{sv})', [uuid, parentWindow, options]),
+            null,
+            Gio.DBusCallFlags.NONE,
+            -1,
+            null);
+        return true;
+    }
+
     notifyExtensionUpdate(uuid) {
         let extension = this.lookup(uuid);
         if (!extension)
index c413df291ef1cde4088dd75ec0fd630321068d35..75a2f341d06de8ddf6e15a76cd4e5aa1e664ca2e 100644 (file)
@@ -316,16 +316,7 @@ var GnomeShellExtensions = class {
     }
 
     OpenExtensionPrefs(uuid, parentWindow, options) {
-        Gio.DBus.session.call(
-            'org.gnome.Shell.Extensions',
-            '/org/gnome/Shell/Extensions',
-            'org.gnome.Shell.Extensions',
-            'OpenExtensionPrefs',
-            new GLib.Variant('(ssa{sv})', [uuid, parentWindow, options]),
-            null,
-            Gio.DBusCallFlags.NONE,
-            -1,
-            null);
+        Main.extensionManager.openExtensionPrefs(uuid, parentWindow, options);
     }
 
     ReloadExtensionAsync(params, invocation) {